package cs2340.todolist.JUnit;


import static org.junit.Assert.assertFalse;

import java.util.ArrayList;

import org.junit.Test;

import cs2340.todolist.model.ToDoItem;
import cs2340.todolist.model.utility.SearchEngine.FilterCompleted;



	public class FilterByCompletedTest {
		private long count = 0;
        private ToDoItem school1 = createToDoItem("Homework");
        private ToDoItem school2 = createToDoItem("Project");
        private ToDoItem school3 = createToDoItem("Test");
        private ToDoItem work1 = createToDoItem("Promote Synergy");
        private ToDoItem work2 = createToDoItem("Micro-manage");
        private ToDoItem work3 = createToDoItem("Send Some Faxes");
        private ToDoItem personal1 = createToDoItem("Birthday Party");
        private ToDoItem personal2 = createToDoItem("Wedding");
        private ToDoItem personal3 = createToDoItem("Spa Day");


	    @Test
	    public void testFilterByCompleted() {
	        ArrayList<ToDoItem> items = new ArrayList();
	        
	        school1.setCompleted(true);
	        personal1.setCompleted(true);
	        work1.setCompleted(true);
	        
	        items.add(school1);
	        items.add(work1);
	        items.add(personal1);
	        items.add(school2);
	        items.add(work2);
	        items.add(personal2);
	        items.add(school3);
	        items.add(work3);
	        items.add(personal3);
	       
	        
	        
	       // Checks to make sure that it has filters out all none-Personal items 
	        new FilterCompleted().filter(items);
	        for (ToDoItem item : items) {
	            assertFalse(item.getCompleted());
	            
	        }
	            
	    }
	    
	    
	    
	    //Method for making a quick ToDoItem
	    public ToDoItem createToDoItem(String title) {
	        ToDoItem item = new ToDoItem(count, title, null , null, null, null, null);
	        return item;
	    }

	}